/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable no-use-before-define */
/* eslint-disable @typescript-eslint/no-use-before-define */
import React, { useEffect } from 'react';
import PageHeaderLayout from '@/layouts/PageHeaderLayout';
import guide from '@/assets/guide.png';
import classNames from 'classnames';
import router from 'umi/router';
import { useDispatch } from 'dva';
import styles from './index.less';

const Index = () => {
  const dispatch = useDispatch();

  const onClick = link => {
    link.indexOf('http') >= 0 ? window.open(link) : router.push(link);
  };

  useEffect(() => {
    dispatch({
      type: 'global/changeLayoutCollapsed',
      payload: true,
    });
  }, []);

  return (
    <PageHeaderLayout>
      <div className={styles.main}>
        <img src={guide} alt="pic" />
        <div
          className={classNames(styles.block, styles.pos1)}
          onClick={() => onClick('/post/area')}
        />
        <div
          className={classNames(styles.block, styles.pos2)}
          onClick={() => onClick('https://mall.tongdiyiyou.com/manage/login')}
        />
        <div
          className={classNames(styles.block, styles.pos3)}
          onClick={() => onClick('https://open.tongdiyiyou.com')}
        />
        <div
          className={classNames(styles.block, styles.pos4)}
          onClick={() => onClick('/help/KbPintBox')}
        />
        <div
          className={classNames(styles.block, styles.pos5)}
          onClick={() => onClick('/platform/datacenter')}
        />
      </div>
    </PageHeaderLayout>
  );
};

export default Index;
